package models

import (
	"time"
)

// HlPayCardholder HlPay开卡人模型
type HlPayCardholder struct {
	ID                         int64      `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
	UserID                     int64      `gorm:"column:user_id;not null;index:idx_user_id" json:"user_id"`
	HlPayCardholderID          string     `gorm:"column:hlpay_cardholder_id;uniqueIndex:uk_hlpay_cardholder_id" json:"hlpay_cardholder_id"`
	FirstName                  string     `gorm:"column:first_name;type:varchar(50);not null" json:"first_name"`
	LastName                   string     `gorm:"column:last_name;type:varchar(50);not null" json:"last_name"`
	CardholderNameAbbreviation string     `gorm:"column:cardholder_name_abbreviation;type:varchar(100)" json:"cardholder_name_abbreviation"`
	Email                      string     `gorm:"column:email;type:varchar(100);not null" json:"email"`
	Mobile                     string     `gorm:"column:mobile;type:varchar(20);not null" json:"mobile"`
	MobilePrefix               string     `gorm:"column:mobile_prefix;type:varchar(10);default:'86'" json:"mobile_prefix"`
	DateOfBirth                *time.Time `gorm:"column:date_of_birth" json:"date_of_birth"`
	CertType                   string     `gorm:"column:cert_type;type:varchar(20);default:'id_card'" json:"cert_type"`
	Portrait                   string     `gorm:"column:portrait;type:varchar(255)" json:"portrait"`
	ReverseSide                string     `gorm:"column:reverse_side;type:varchar(255)" json:"reverse_side"`
	NationalityCountryCode     string     `gorm:"column:nationality_country_code;type:varchar(10);default:'HK'" json:"nationality_country_code"`
	ResidentialAddress         string     `gorm:"column:residential_address;type:varchar(255)" json:"residential_address"`
	ResidentialCity            string     `gorm:"column:residential_city;type:varchar(100)" json:"residential_city"`
	ResidentialCountryCode     string     `gorm:"column:residential_country_code;type:varchar(10);default:'HK'" json:"residential_country_code"`
	ResidentialPostalCode      string     `gorm:"column:residential_postal_code;type:varchar(20)" json:"residential_postal_code"`
	ResidentialState           string     `gorm:"column:residential_state;type:varchar(50)" json:"residential_state"`
	Status                     string     `gorm:"column:status;type:varchar(20);default:'ACTIVE';index:idx_status" json:"status"`
	CreatedAt                  time.Time  `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP" json:"created_at"`
	UpdatedAt                  time.Time  `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" json:"updated_at"`
	MatrixAccount              string     `gorm:"column:matrix_account;type:varchar(100)" json:"matrix_account"`
	MemberID                   string     `gorm:"column:member_id;type:varchar(100)" json:"member_id"`
	IsLegal                    string     `gorm:"column:is_legal;type:varchar(10);default:'N'" json:"is_legal"`
	CardholderReviewStatus     string     `gorm:"column:cardholder_review_status;type:varchar(50);default:'cert_required'" json:"cardholder_review_status"`
	Reason                     string     `gorm:"column:reason;type:varchar(255)" json:"reason"`
}

// TableName 获取表名
func (HlPayCardholder) TableName() string {
	return "hlpay_cardholders"
}

// CreateHlPayCardholderRequest 创建HlPay开卡人请求
type CreateHlPayCardholderRequest struct {
	UserID                     int64  `json:"user_id" binding:"required"`
	FirstName                  string `json:"firstName" binding:"required"`
	LastName                   string `json:"lastName" binding:"required"`
	CardholderNameAbbreviation string `json:"cardholderNameAbbreviation"`
	Email                      string `json:"email" binding:"required,email"`
	Mobile                     string `json:"mobile" binding:"required"`
	MobilePrefix               string `json:"mobilePrefix"`
	DateOfBirth                string `json:"dateOfBirth"`
	CertType                   string `json:"certType"`
	Portrait                   string `json:"portrait"`
	ReverseSide                string `json:"reverseSide"`
	NationalityCountryCode     string `json:"nationalityCountryCode"`
	ResidentialAddress         string `json:"residentialAddress"`
	ResidentialCity            string `json:"residentialCity"`
	ResidentialCountryCode     string `json:"residentialCountryCode"`
	ResidentialPostalCode      string `json:"residentialPostalCode"`
	ResidentialState           string `json:"residentialState"`
	MatrixAccount              string `json:"matrixAccount"` // 矩阵账户
	MemberID                   string `json:"memberID"`      // 会员ID
}

// UpdateHlPayCardholderRequest 更新HlPay开卡人请求
type UpdateHlPayCardholderRequest struct {
	ID                         int64  `json:"id" binding:"required"`
	FirstName                  string `json:"firstName"`
	LastName                   string `json:"lastName"`
	CardholderNameAbbreviation string `json:"cardholderNameAbbreviation"`
	Email                      string `json:"email" binding:"email"`
	Mobile                     string `json:"mobile"`
	MobilePrefix               string `json:"mobilePrefix"`
	DateOfBirth                string `json:"dateOfBirth"`
	CertType                   string `json:"certType"`
	Portrait                   string `json:"portrait"`
	ReverseSide                string `json:"reverseSide"`
	NationalityCountryCode     string `json:"nationalityCountryCode"`
	ResidentialAddress         string `json:"residentialAddress"`
	ResidentialCity            string `json:"residentialCity"`
	ResidentialCountryCode     string `json:"residentialCountryCode"`
	ResidentialPostalCode      string `json:"residentialPostalCode"`
	ResidentialState           string `json:"residentialState"`
	Status                     string `json:"status"`
}

// HlPayCardholderResponse HlPay开卡人响应
type HlPayCardholderResponse struct {
	ID                         int64      `json:"id"`
	UserID                     int64      `json:"user_id"`
	HlPayCardholderID          string     `json:"hlpay_cardholder_id"`
	FirstName                  string     `json:"first_name"`
	LastName                   string     `json:"last_name"`
	CardholderNameAbbreviation string     `json:"cardholder_name_abbreviation"`
	Email                      string     `json:"email"`
	Mobile                     string     `json:"mobile"`
	MobilePrefix               string     `json:"mobile_prefix"`
	DateOfBirth                *time.Time `json:"date_of_birth"`
	CertType                   string     `json:"cert_type"`
	Portrait                   string     `json:"portrait"`
	ReverseSide                string     `json:"reverse_side"`
	NationalityCountryCode     string     `json:"nationality_country_code"`
	ResidentialAddress         string     `json:"residential_address"`
	ResidentialCity            string     `json:"residential_city"`
	ResidentialCountryCode     string     `json:"residential_country_code"`
	ResidentialPostalCode      string     `json:"residential_postal_code"`
	ResidentialState           string     `json:"residential_state"`
	Status                     string     `json:"status"`
	CreatedAt                  time.Time  `json:"created_at"`
	UpdatedAt                  time.Time  `json:"updated_at"`
	MatrixAccount              string     `json:"matrix_account"`
	MemberID                   string     `json:"member_id"`
	IsLegal                    string     `json:"is_legal"`
	CardholderReviewStatus     string     `json:"cardholder_review_status"`
	Reason                     string     `json:"reason"`
}
